<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var num = prompt ('请输入行数');
        var num1 = prompt ('请输入列数');
        let star = '';
        for (let i = 0; i < num; i++){
            
            for (let k = 0; k < num1; k++){
                star = star + '*';
            }
            star = star + '\n';
        }
 alert(star);
 console.log(star);
/* 双重 for 循环
语法结构：
for（初始化变量; 判断条件; 变化条件;）{
    for (初始化变量; 判断条件; 变化条件){
        逻辑体;
    }
}
特点：内存循环是外层循环的循环体。
外层循环一次，内层循环全部。 */


for (let i = 0; i < 5; i++) {
            console.log('i此时是' + i + ',外层循环----------------');
            for (let k = 0; k < 2; k++) {
                console.log('k此时是' + i + ',内层循环');
            }
        }

    </script>
</body>
</html>